-
Notifications
You must be signed in to change notification settings - Fork 684
feat(amazonq): Add Pin Context Tests and Update to pinContextHelper #7829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/ui-e2e-tests
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
looks like we need to rebase the latest changes based on the github actions |
feature --> feat
|
export async function getSubMenuItems(webview: WebviewView): Promise<{ items: WebElement[]; labels: string[] }> { | ||
try { | ||
const menuList = await waitForElement(webview, By.css('.mynah-detailed-list-items-block')) | ||
await sleep(3000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this additional sleep needed?
console.log('Menu item found:', labelText) | ||
} catch (e) { | ||
labels.push('') | ||
console.log('Could not get text for menu item') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we fail here? If we can't find an item in the menu isn't that indicative of a bug?
|
||
return { items: menuListItems, labels } | ||
} catch (e) { | ||
console.error('Error getting Pin Context menu items:', e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question here.
export async function clickSubMenuItem(webview: WebviewView, itemName: string): Promise<boolean> { | ||
try { | ||
const menuList = await waitForElement(webview, By.css('.mynah-detailed-list-items-block')) | ||
await sleep(3000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this sleep needed? Shouldn't it be covered by waitForElement?
return true | ||
} | ||
} catch (e) { | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question as above about errors.
console.log(`Pin Context menu item not found: ${itemName}`) | ||
return false | ||
} catch (e) { | ||
console.error(`Error clicking Pin Context menu item ${itemName}:`, e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this fails I think we should throw instead of returning a boolean.
await createPrompt.click() | ||
await clickPinContextButton(webviewView) | ||
await clickPinContextMenuItem(webviewView, 'Prompts') | ||
await clickSubMenuItem(webviewView, 'test') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my understanding is that this returns a boolean false if it fails, but this won't cause the test to fail.
await clickPinContextMenuItem(webviewView, '@workspace') | ||
}) | ||
it('Prompts Context Test', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same idea before on test labels.
Looks like there is some duplicate logic:
but appears to be some overlapping comments. Could be worth trying to reduce duplication here, but don't see it as a blocker. |
for (const button of buttons) { | ||
const label = await button.findElement(By.css('.mynah-button-label')) | ||
const labelText = await label.getText() | ||
console.log('THE BUTTON TEXT LABEL IS:', labelText) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this for debugging? Do we want to this run on text execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh do you mean the console.log statements?
const menuListItems = await menuList.findElements(By.css('.mynah-detailed-list-item.mynah-ui-clickable-item')) | ||
const labels: string[] = [] | ||
const menuList = await waitForElement(webview, By.css('.mynah-detailed-list-items-block')) | ||
// TODO: Fix the need for a sleep function to be required at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty
const nameElement = await textWrapper.findElement(By.css('.mynah-detailed-list-item-name')) | ||
const labelText = await nameElement.getText() | ||
labels.push(labelText) | ||
console.log('Menu item found:', labelText) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, how noisy are the logs when running the full test suite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logs aren't too noisy, I actually think they're helpful to see the process of the test in my opinion
Problem
We have yet to implement the initial P0 Pin Context Tests. The pinContextHelper does not mesh well with sub menu items when clicking through different prompts to use.
Solution
I have implemented the File Context and Prompt Context Test. The Pin Context test with the @workspace was previously implemented. I have implemented the helpers: getSubMenuItems and clickSubMenuItem in the pinContextHelper. All tests still run together.
Test Suite:
feature/x
branches will not be squash-merged at release time.